import datetime
from flask import Flask
from flask_restful import Api
from flask_sqlalchemy import SQLAlchemy
from flask_jwt_extended import  JWTManager 
from flask_cors import CORS
import logging

app = Flask(__name__)
CORS(app, supports_credentials=True)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///db.sqlite'
app.config['SECRET_KEY'] = 'yepanpan'
app.config['JWT_SECRET_KEY'] = 'yepanpan-python' 
app.config['SQLALCHEMY_ECHO'] = True
app.config['MODEL_PATH'] = "./models/"
app.config['DATASET_PATH'] = "./datasets/"
app.config['RUN_MODE'] = 'prod'
app.config['JWT_ACCESS_TOKEN_EXPIRES'] = datetime.timedelta(minutes=120)

logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)

db = SQLAlchemy(app)
api = Api(app)
jwt = JWTManager(app)